<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    <title>6.27. Bash-3.1</title>
    <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
  <body id="lfs" class="6.2">
    <div class="navheader">
      <div class="headertitles">
        <h4>Linux From Scratch - 版本 6.2</h4>
        <h3>第六章 安装系统基础软件</h3>
      </div>
      <ul class="headerlinks">
        <li class="prev">
          <a accesskey="p" href="automake.html" title="Automake-1.9.6">后退</a>
          <p>Automake-1.9.6</p>
        </li>
        <li class="next">
          <a accesskey="n" href="bzip2.html" title="Bzip2-1.0.3">前进</a>
          <p>Bzip2-1.0.3</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a></li>
      </ul>
    </div>
    <div class="wrap">
      <div class="titlepage">
        <h1 class="sect1">6.27. Bash-3.1</h1>
      </div>
      <div class="package">
        <p>Bash 是 Bourne-Again Shell 的缩写，它在 UNIX 系统中作为 shell 被广泛使用。</p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">预计编译时间：</span></strong> <span class="seg">0.4 SBU</span>
            </div>
            <div class="seg">
              <strong><span class="segtitle">所需磁盘空间：</span></strong> <span class="seg">25.8 MB</span>
            </div>
          </div>
        </div>
      </div>
      <div class="installation">
        <div class="titlepage">
          <h2 class="sect2">6.27.1. 安装 Bash</h2>
        </div>
        <p>如果你下载了Bash的文档包，可以通过下面的命令安装：</p>
        <pre class="userinput"><kbd class="command">tar -xvf ../bash-doc-3.1.tar.gz &amp;&amp;
sed -i "s|htmldir = @htmldir@|htmldir = /usr/share/doc/bash-3.1|" \
    Makefile.in</kbd></pre>
        <p>上游开发者解决了从Bash-3.1后的一些问题：</p>
        <pre class="userinput"><kbd class="command">patch -Np1 -i ../bash-3.1-fixes-8.patch</kbd></pre>
        <p>为编译 Bash 做准备：</p>
        <pre class="userinput"><kbd class="command">./configure --prefix=/usr --bindir=/bin \
    --without-bash-malloc --with-installed-readline</kbd></pre>
        <div class="variablelist">
          <p class="title">
            <b>配置选项的含义：</b></p>
          <dl>
            <dt>
              <span class="term"><em class="parameter"><tt>--with-installed-readline</tt></em></span>
            </dt>
            <dd>
              <p>这个选项是告诉 Bash 使用已经安装的系统的 <tt class="filename">readline</tt> 库，而不是它自己的 readline 版本。</p>
            </dd>
          </dl>
        </div>
        <p>编译软件包：</p>
        <pre class="userinput"><kbd class="command">make</kbd></pre>
        <p>要测试结果，请运行：<strong class="userinput"><tt>make tests</tt></strong> 。</p>
        <p>安装软件包：</p>
        <pre class="userinput"><kbd class="command">make install</kbd></pre>
        <p>运行新编译的 <span><strong class="command">bash</strong></span> 程序来替换正在执行的这一个：</p>
        <pre class="userinput"><kbd class="command">exec /bin/bash --login +h</kbd></pre>
        <div class="note">
          <div class="admonhead">
            <img alt="[Note]" src="../images/note.png" />
            <h3 class="admontitle">注意</h3>
          </div>
          <div class="admonbody">
           <p>上面命令里使用的参数指示 <span><strong class="command">bash</strong></span> 产生一个交互式的登陆 shell 并且继续禁用哈希功能，以便新的程序一旦被安装就立即投入使用。</p>
          </div>
        </div>
      </div>
      <div class="content">
        <div class="titlepage">
          <a id="contents-bash" name="contents-bash"></a>
          <h2 class="sect2">6.27.2. Bash 的内容</h2>
        </div>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong><span class="segtitle">安装的程序：</span></strong> <span class="seg">bash, bashbug, sh(→bash)</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3><a id="id3684196" name="id3684196"></a>简要描述</h3>
          <table border="0">
            <col align="left" valign="top" />
            <tbody>
              <tr>
                <td><a id="bash" name="bash"></a><span class="term"><span><strong class="command">bash</strong></span></span></td>
                <td><p>作为命令行解释器被广泛使用。它能在执行命令前解释非常复杂的命令行参数，这使它成为一个强大的工具。</p></td>
              </tr>
              <tr>
                <td><a id="bashbug" name="bashbug"></a><span class="term"><span><strong class="command">bashbug</strong></span></span></td>
                <td><p>帮助用户用标准格式编写和提交有关 <span><strong class="command">bash</strong></span> 的bug报告的脚本。</p></td>
              </tr>
              <tr>
                <td><a id="sh" name="sh"></a><span class="term"><span><strong class="command">sh</strong></span></span></td>
                <td><p>指向 <span><strong class="command">bash</strong></span> 的符号连接。当运行 <span><strong class="command">sh</strong></span> 的时候，<span><strong class="command">bash</strong></span> 会尽量模仿老的 <span><strong class="command">sh</strong></span> 历史环境来运行，同时遵循 POSIX 标准。</p></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="automake.html" title="Automake-1.9.6">后退</a>
          <p>Automake-1.9.6</p>
        </li>
        <li class="next">
          <a accesskey="n" href="bzip2.html" title="Bzip2-1.0.3">前进</a>
          <p>Bzip2-1.0.3</p>
        </li>
        <li class="up"><a accesskey="u" href="chapter06.html" title="第六章 安装系统基础软件">上一级</a></li>
        <li class="home"><a accesskey="h" href="../index.html" title="Linux From Scratch - 版本 6.2">首页</a>.
        </li>
      </ul>
    </div>
</body></html>
